﻿using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace EShop.Models
{
    [Bind(Exclude = "OrderId")]
    public partial class Order
    {
        [ScaffoldColumn(false)]
        public int OrderId { get; set; }

        [ScaffoldColumn(false)]
        public System.DateTime OrderDate { get; set; }

        [ScaffoldColumn(false)]
        public string Username { get; set; }

        [Required(ErrorMessage = "输入贵姓")]
        [DisplayName("贵姓")]
        [StringLength(160)]
        public string FirstName { get; set; }

        [Required(ErrorMessage = "输入名字")]
        [DisplayName("名字")]
        [StringLength(160)]
        public string LastName { get; set; }

        [Required(ErrorMessage = "输入地址")]
        [DisplayName("地址")]
        [StringLength(70)]
        public string Address { get; set; }

        [Required(ErrorMessage = "输入城市")]
        [DisplayName("城市")]
        [StringLength(40)]
        public string City { get; set; }

        [Required(ErrorMessage = "输入省/市")]
        [DisplayName("省")]
        [StringLength(40)]
        public string State { get; set; }

        [Required(ErrorMessage = "输入邮编")]
        [DisplayName("输入邮编")]
        [StringLength(10)]
        public string PostalCode { get; set; }

        [Required(ErrorMessage = "输入国家")]
        [DisplayName("国家")]
        [StringLength(40)]
        public string Country { get; set; }

        [Required(ErrorMessage = "输入电话")]
        [DisplayName("电话")]
        [StringLength(24)]
        public string Phone { get; set; }

        [Required(ErrorMessage = "输入Email")]
        [DisplayName("电子邮件")]
        [RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}",
            ErrorMessage = "Email is is not valid.")]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [ScaffoldColumn(false)]
        public decimal Total { get; set; }

        public List<OrderDetail> OrderDetails { get; set; }
    }
}
